﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using UtilZ.Dotnet.Ex.Attributes;

namespace UtilZ.Dotnet.Ex.ValueDescription
{
    /// <summary>
    /// 常量项
    /// </summary>
    public class ConstantValueItem
    {
        private readonly string _displayName;
        /// <summary>
        /// 常量项显示名称
        /// </summary>
        public string DisplayName
        {
            get
            {
                return this._displayName;
            }
        }

        private string _description = null;
        /// <summary>
        /// 常量项描述
        /// </summary>
        public string Description
        {
            get
            {
                return this._description;
            }
        }

        private readonly object _value;
        /// <summary>
        /// 常量值
        /// </summary>
        public object Value
        {
            get
            {
                return this._value;
            }
        }

        /// <summary>
        /// 获取描述特性
        /// </summary>
        public DescriptionAttribute DescriptionAtt { get; internal set; }

        /// <summary>
        /// 获取显示特性
        /// </summary>
        public DisplayNameAttribute DisplayNameAtt { get; internal set; }




        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="displayName">常量项显示名称</param>
        /// <param name="des">常量项描述</param>
        /// <param name="value">常量值</param>
        public ConstantValueItem(string displayName, string des, object value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            this._value = value;
            this._displayName = displayName;
            this._description = des;
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="displayName">常量项显示名称</param>
        /// <param name="value">常量值</param>
        public ConstantValueItem(string displayName, object value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            this._value = value;
            this._displayName = displayName;
        }
    }
}
